//单例-饿汉模式
//唯一实例创建早
class Singleton{
    private static Singleton instence = new Singleton();
    //保证实例的唯一性，构造方法无法被调用。
    private Singleton() {
    }
    //通过方法来获取单例
    public static Singleton getInstence() {
    return instence;
    }
}
public class Singleton1 {
    public static void main(String[] args) {
        Singleton  s1 = Singleton.getInstence();
        Singleton  s2 = Singleton.getInstence();
        System.out.println(s1 == s2);
    }
}